Report Signal Graphic

To create a signal graphic use TPTReport.SignalGraphic(). There are two ways to add signals to the graphic. Either you directly choose the signals to add using signalGraphic.add([signal1,signal2,...]) or indirectly by using a filter TPTReport.Filter() (see Example 2).

By default, an automatic caption is displayed along with the graphic. This caption is formed by the names of the signals that are displayed in the table. To add a "custom" caption, use the function setCaption().

Struct signal graphic in report

Example 1

In this example, signals are added to the graphic using the add() function.

#creates a new report section

sect = TPTReport.Section("My Foo Bar Graphic Report Section")

TPTReport.add(sect)

#creates a new paragraph in the previously created section

paragr = TPTReport.Paragraph("This is my foo bar graphic paragraph, where I can write custom text.")

sect.add(paragr)

#creates a new signal graphic with the signal foo and bar and a custom caption

sect = TPTReport.Section("My Foo Bar Graphic Report Section")

sig_graph = TPTReport.SignalGraphic()

TPTReport.add(sig_graph)

sig_graph.add([foo,bar])

sig_graph.setCaption("This is my custom caption.")

Script signal graphic example 1

Example 2

This example shows how to add signals to the graphic using a filter. The same filter options that apply to the assesslet to filter signal are available.

#creates a new report section

sect = TPTReport.Section("Signal Graphic with filters")

TPTReport.add(sect)

#creates a new paragraph in the previously created section

paragr = TPTReport.Paragraph("The results in this graphic are already filtered.")

sect.add(paragr)

#creates a new signal graphic with the signal foo and bar and a custom caption

sect = TPTReport.Section("Signal Graphic with filters")

sig_graph_2 = TPTReport.SignalGraphic()

TPTReport.add(sig_graph_2)

sig_graph_2.setCaption("NO Parameters and only signals starting with *light*")

# add signals using a filter

signal_filter = TPTReport.Filter()

# include channels but no parameters

signal_filter.setShowInputs(true)

signal_filter.setShowOutputs(true)

signal_filter.setShowLocals(true)

signal_filter.setShowParameters(false)

# filter pattern, only include signals starting with "light"

signal_filter.setFilterPattern(r'light.*')

signal_filter.setIncludeFilter(true)

# apply filter

sig_graph_2.applyFilter(signal_filter)

Script signal graphic example 2

To set up the signal graphic using a graphical user interface, see Assesslets - Report Signal Graphic.